<template>
  <div class="page">
    多线程进行文件上传切片计算hash值<input type="file" @change="onChange" />
  </div>
</template>
<script>
import { cutFile } from "./cutFile.js";
export default {
  name: "WorkerIndex",
  data() {
    return {};
  },
  methods: {
    async onChange(e) {
      let file = e.target.files[0];
      console.log(file, "file");
      const startTime = performance.now();
      const chunks = await cutFile(file);
      console.log(chunks, "切片后的文件数组集"); //多个Blob文件对象
      const time = performance.now() - startTime;
      console.log(time + "ms", "耗时时间");
    },
  },
};
</script>

<style scoped lang="less"></style>
